require.config({
  paths : {
    'backbone' : './libs/backbone',
    'underscore' : './libs/underscore',
    'jquery' : './libs/jquery',
    'text' : './libs/text',
    'css' : './libs/css',
    'banner' : './home/js/banner',
    'homeMain' : './home/js/homemain',
    'Crequick' : './quick/js/Crequick'
  }
});

require(['backbone'], function(Backbone){
  var Router = Backbone.Router.extend({
    routes : {
      '' : 'quick',
      'home' : 'home',
      'quick' : 'quick',
      'shoppingCar' : 'shoppingCar',
      'mine' : 'mine'
    },
    home : function(){
      require(['jquery','text!./home/home.html', 'banner' ,'css!./home/css/home.css'], function($,html,banner){
      	$.getJSON('./home/js/home.json', function(res){
						//轮播图解析		
			    	banner.bannerJX(res.data.act_info[0].act_rows);
			    	
			    	//
			    	banner.Main_oneJX(res.data.act_info[1].act_rows);
			    	
			    	//
			    	banner.Main_twoJX(res.data.act_info[3].act_rows);
			    	
			    	//
			    	banner.Main_threeJX(res.data.act_info[4].act_rows);
			    	
			    	//
			    	banner.Main_fourJX(res.data.act_info[5].act_rows);
			    	
			    });
        $('.content').html(html);
      })
    },
    quick : function(){
      require(['jquery','text!./quick/quick.html', 'Crequick','css!./quick/css/quick.css'], function($,html,Crequick){
      	$.getJSON('./quick/js/cateGory.json', function(res){
					Crequick.creNav(res.data.categories);
					Crequick.crePro(res.data.products[104749]);
					
					$('.quick_nav_li').click(function(){
						var id = $(this).attr('id');
//						$('.quick_pro_ul').html('');
						Crequick.crePro(res.data.products[id]);	
					});		
				});
					
        $('.content').html(html);
      })
    },
    mine : function(){
      require(['jquery','text!./mine/mine.html', 'css!./mine/css/mine.css'], function($,html){
        $('.content').html(html);
      })
    }
  })

  var router = new Router();
  Backbone.history.start();
});
